module.exports = {

	loading(text = '数据加载中...', background) {
		return this.$loading({
			lock: true,
			text,
			spinner: 'el-icon-loading',
			background: 'rgba(0, 0, 0, 0.7)'
		})
	},

	getUeditors(editorIdArr) {
		let all = []
		for (let i = 0; i < editorIdArr.length; i++) {
			let id = editorIdArr[i]
			all.push(initUeditor(id))
		}
		return Promise.all(all)
	},

}

function initUeditor(id) {
	return new Promise((resolve, reject) => {
		let editor = UE.getEditor(id);
		editor.ready(() => {
			UE.delEditor(id)
			setTimeout(() => {
				editor = UE.getEditor(id)
				editor.ready(() => {
					resolve(editor)
				})
			}, 80)
		})
	});
}